

<?php $this->start('topMenu'); ?>

<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="nav navbar-left">
        <div class="nav navbar-nav navbar-header">
            <span class="navbar-brand" >  
                <?php echo $this->Html->image('MSC.png', array('margin-top' => '10px', 'height' => '90px')); ?>
            </span>
        </div>
        <div class="span2">
            <!-- formulaire de recherche -->
            <?php
            echo $this->Form->create('Nav', array(
                'inputDefaults' => array(
                    'div' => false,
                    'wrapInput' => false
                ),
                'class' => 'form-search'
            ));
            ?>
            <!-- barre de recherche -->
            <?php
            echo $this->Form->input('text', array(
                'label' => false,
                'class' => 'input-medium search-query',
                'placeholder' => 'Rechercher',
                'name' => 'cles'
            ));
            ?>
            <button type="submit" class="btn btn-default" name="rechercher" value="rechercher">
                <span class="glyphicon glyphicon-search"></span>
            </button>
            <?php echo $this->Form->end(); ?>
        </div>

    </div>


    <div id="controls" >
        <ul id="controlToggle">
            <li>
                <input type="radio" name="type" value="naviguer" id="noneToggle"
                       onclick="toggleControl(this);"  />
                <label for="noneToggle">Naviguer</label>
                <?php if (AuthComponent::user('id')): ?> <!-- permet de récupèrer l'utilisateur connecté : équivalent d'un $_SESSION[] -->
                    <input type="radio" name="type" value="point" id="pointToggle" onclick="toggleControl(this);" />
                    
                    <label for="pointToggle">Ajouter un stade</label>
                </li>
                <li>
                    <?php echo $this->Form->input('nom_stade', array('label' => __('Nom'), 'id' => 'stadeToggle', 'requiered')) ?>
                    <?php echo $this->Form->input('coorx', array('label' => 'Lat', 'id' => 'nav_coorx', 'readonly')) ?>
                    <?php echo $this->Form->input('coory', array('label' => 'Lng', 'id' => 'nav_coory', 'readonly')) ?>
                    <?php echo $this->Form->input('valider', array('id' => 'valider', 'type' => 'button', 'onclick' => 'ajouter()')); ?>
                <?php endif; ?>
            </li>

        </ul>
    </div>

    <div class="nav navbar-right">

        <?php if (AuthComponent::user('id')): ?>
            <li>
                <?php echo $this->Html->link(__('Se déconnecter'), array('action' => 'logout', 'controller' => 'users')); ?>
            </li>
        <?php else: ?>
            <li> 
                <?php
                echo $this->Form->create('User', array('inputDefaults' => array(
                        'div' => false,
                        'label' => false,
                        'wrapInput' => false
                    ), 'action' => 'login', 'class' => 'form-inline'));
                ?>
                <?php echo $this->Form->input('username', array('placeholder' => 'Login')); ?>
                <?php echo $this->Form->input('password', array('placeholder' => 'Password')); ?>
                <br/>
                <?php
                echo $this->Html->link(__('Mot de passe oublié'), array('action' => 'password', 'controller' => 'users')) . ' ' .
                $this->Html->link(__('Créer un compte'), array('action' => 'signup', 'controller' => 'users'));
                ?>
                <?php echo $this->Form->end("Se connecter"); ?>
            </li>
        <?php endif; ?>

    </div>
</nav>
<footer style=" display : none">
    <!-- formulaires caché que manipule le JavaScript-->
    <?php
    if (AuthComponent::user('id')):
        //ajout du stade dans la bdd
        echo $this->Form->create('Stade', array('action' => 'creation'));
        echo $this->Form->input('nom_STADE', array('label' => 'Nom'));
        echo $this->Form->input('coorx_STADE', array('label' => 'Lat'));
        echo $this->Form->input('coory_STADE', array('label' => 'Lng'));
        echo $this->Form->input('ajoute_par_STADE', array('value' => "" . AuthComponent::user('username') . ""));
        echo $this->Form->end();
        ?>   
        <?php
    endif;
    //affiche du stade dans la bdd
    echo $this->Form->create('Stade', array('id' => 'currentStade', 'action' => 'infostade'));
    echo $this->Form->input('coorx', array('label' => 'Lat', 'id' => 'coorx'));
    echo $this->Form->input('coory', array('label' => 'Lng', 'id' => 'coory'));
    echo $this->Form->end();
    ?>
</footer>
<?php $this->end(); ?>

<?php $this->start('map'); ?>
<div id="map" class="map">

</div>
<?php $this->end(); ?>
